package com.androidbook.triviaquiz;


import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

public class QuizSplashActivity extends QuizActivity {
    /** Called when the activity is first created. */
    @Override
    
    protected void onPause(){
    	super.onPause();
    	TextView logo1 = (TextView) findViewById(R.id.TextViewTopTitle);
        ImageView logo2 = (ImageView) findViewById(R.id.imageView1);
        TextView logo3 = (TextView) findViewById(R.id.TextViewBottomVersion);
        logo1.clearAnimation();
        logo2.clearAnimation();
        logo3.clearAnimation();
    }
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        TextView logo1 = (TextView) findViewById(R.id.TextViewTopTitle);
        ImageView logo2 = (ImageView) findViewById(R.id.imageView1);
        TextView logo3 = (TextView) findViewById(R.id.TextViewBottomVersion);
        Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.fade_in);
        Animation fade2 = AnimationUtils.loadAnimation(this, R.anim.fade_in2);
        Animation fade3 = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
        logo1.startAnimation(fade1);
        logo2.startAnimation(fade3);
        logo3.startAnimation(fade2);
        
        fade2.setAnimationListener(new AnimationListener() {
        	public void onAnimationEnd(Animation animation){
        		startActivity(new Intent(QuizSplashActivity.this, QuizMenuActivity.class));
        		QuizSplashActivity.this.finish();
        	}

			public void onAnimationRepeat(Animation arg0) {
				// TODO Auto-generated method stub
				
			}

			public void onAnimationStart(Animation arg0) {
				// TODO Auto-generated method stub
				
			}
        });
        
    }
    
    
}